---
apiVersion: v1
kind: Pod
metadata:
  name: {{ ansible_operator_meta.name }}-db-management
  namespace: {{ backup_pvc_namespace }}
  labels:
    {{ lookup("template", "../common/templates/labels/common.yaml.j2") | indent(width=4) | trim }}
spec:
  containers:
  - name: {{ ansible_operator_meta.name }}-db-management
    image: "{{ _postgres_image }}"
    imagePullPolicy: "{{ image_pull_policy }}"
    command: ["sleep", "infinity"]
    volumeMounts:
    - name: {{ ansible_operator_meta.name }}-backup
      mountPath: /backups
      readOnly: false
{% if restore_resource_requirements is defined %}
    resources:
      {{ restore_resource_requirements | to_nice_yaml(indent=2) | indent(width=6, first=False) }}
{%- endif %}
{% if db_management_pod_node_selector %}
      nodeSelector:
        {{ db_management_pod_node_selector | indent(width=8) }}
{% endif %}
  volumes:
    - name: {{ ansible_operator_meta.name }}-backup
      persistentVolumeClaim:
        claimName: {{ backup_pvc }}
        readOnly: false
  restartPolicy: Never
